home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: mxsld2.pd.infn.it!LORETI
- From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
- Subject: Re: leap year
- X-Nntp-Posting-Host: mxsld2.pd.infn.it
- Message-ID: <Dov6qE.EwC@news.cern.ch>
- Sender: news@news.cern.ch (USENET News System)
- Reply-To: loreti@mxsld2.pd.infn.it
- Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
- References: <4iq64e$evq@daryl.scsn.net>
- Date: Tue, 26 Mar 1996 07:42:08 GMT
-
- In article <4iq64e$evq@daryl.scsn.net>, shrader@scsn.net (Scott Shrader) writes:
- >can anyone tell me in C how do I write a program so it can tell me if a
- >year is a leap year.
-
- ... another way is to code
-
- if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
- /* year is a leap year */
- } else {
- /* not. */
- }
-
- --
- Maurizio Loreti http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
- Un. of Padova, Dept. of Physics - Padova, Italy loreti@padova.infn.it
-